#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<string>

using namespace std;

int LastWordLength(string s)
{
	int pos = s.rfind(' ', s.size() - 1);
	if (pos == string::npos)
	{
		return s.size();
	}
	else 
	{
		int length = s.size() - 1 - pos;
		return length;
	}
	
}

int main()
{
	string s;
	getline(cin, s);
	int length = LastWordLength(s);
	cout << s << endl;
	cout << length << endl;
	return 0;
}